from django.db import models
from apps.users.models import Users_model
# Create your models here.
class Messages_model(models.Model):
    msg_deal_person = models.ForeignKey(Users_model,related_name='deal_person',on_delete=models.CASCADE,null=False,verbose_name='消息处理人')
    msg_launch_person = models.ForeignKey(Users_model,related_name='launch_person',null=False,on_delete=models.CASCADE,verbose_name='消息发起人')
    msg_receive_time = models.DateTimeField(auto_now_add=True, verbose_name='消息接收时间')
    modular_from_choices = (
        (0, '公告模块'),
        (1, '人力资源模块'),
        (2, '业务模块'),
        (3, '财务模块'),
    )
    msg_modular_from = models.IntegerField(verbose_name='消息来源模块', choices=modular_from_choices, default=None, null=False)
    msg_simple_text = models.CharField(max_length=255,null=False,verbose_name='消息简述')
    msg_detail_text = models.TextField(null=False,verbose_name='消息详述')
    is_read_choices = (
        (0, '已阅'),
        (1, '未阅'),
    )
    msg_is_read = models.IntegerField(verbose_name='已阅未阅', choices=modular_from_choices, default=1, null=False)
    is_done_choices = (
        (0, '已处理'),
        (1, '未处理'),
    )
    msg_is_done = models.IntegerField(verbose_name='已未/处理', choices=is_done_choices, default=1, null=False)

    class Meta:
        verbose_name_plural = '消息表'
